import { Column, Entity, ManyToMany } from 'typeorm';
import { BaseEntity } from '../../../common/baseEntity/index';
import { Article } from '../../article/entities/article.entity';

@Entity('tag')
export class Tag extends BaseEntity {
  @Column({ type: 'varchar', length: 50, comment: '标签名称' })
  name: string;

  @Column({ type: 'varchar', length: 255, nullable: true, comment: '标签链接' })
  slug: string;

  @Column({ type: 'varchar', length: 255, nullable: true, comment: '关键词' })
  keywords: string;

  @Column({ type: 'varchar', length: 255, nullable: true, comment: '描述' })
  description: string;

  @ManyToMany(() => Article, article => article.tags, {})
  articles: Article[];
}
